#include <stdio.h>
#include <malloc.h>

typedef struct Node{
    int data;
    struct Node* next;
} SLNode;

SLNode* CreateNode(int data) {
    SLNode* newnode = (SLNode*)malloc(sizeof(SLNode));
    newnode->data = data;
    newnode->next = NULL;
    return newnode;
}

SLNode* CreateList(int n) {
    SLNode* head = NULL;
    SLNode* tail = NULL;
    SLNode* newnode = NULL;
    for (int i = 0; i < n; i++)
    {
        if (head == NULL) {
            head = CreateNode(i);
            tail = head;
        }
        else {
            newnode = CreateNode(i);
            tail->next = newnode;
            tail = newnode;
        }
    }
    return head;
}

int main() {
    int n;
    scanf("%d", &n);
    SLNode* SList = CreateList(n);
    SLNode* node = SList;
    for (int i = 0; i < n; i++)
    {
        printf("%d\n", node->data);
        node = node->next;
    }
    

    return 0;
}